﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<!-- source http://www.scnoob.com More templates http://www.scnoob.com/moban -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>订单详情</title>

    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/bootstrap.min.css}">

    <link rel="stylesheet" type="text/css" th:href="@{/assets/fonts/line-icons.css}">

    <link th:href="@{/assets/plugins/datatables/dataTables.bootstrap4.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/assets/plugins/datatables/buttons.bootstrap4.min.css}" rel="stylesheet" type="text/css"/>

    <link th:href="@{/assets/plugins/datatables/responsive.bootstrap4.min.css}" rel="stylesheet" type="text/css"/>

    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/main.css}">

    <link rel="stylesheet" type="text/css" th:href="@{/assets/css/responsive.css}">
</head>
<body>
<div class="app header-default side-nav-dark">
    <div class="layout">
        <div class="header navbar">
            <div class="header-container">
                <ul class="nav-left">
                    <li>
                        <a href="javascript:history.back(-1);">
                            <i class="lni-chevron-left" style="border: transparent;"></i>
                        </a>
                    </li>
                </ul>

                <ul class="nav-right" style="margin-right: 20px;">
                    <li class="user-profile dropdown dropdown-animated scale-left">
                        <a th:href="@{/front/user/userPath(referId=${referId})}">
                            我的
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="page-container" style="padding: 64px 0 0 0!important;background-color: #f1f2f7;">
            <div class="main-content" style="padding-top: 15px!important;">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-12">

                            <div class="card" style="border-radius: 10px;width: 100%;margin-bottom: 10px">
                                <div class="card-header border-bottom">
                                    <h4 class="card-title">订单详情</h4>
                                    <div style="color: red" id="tips"></div>
                                    <div type="text" style="display: none" id="userId"
                                         th:text="${session.userEntity.id}"></div>
                                </div>
                            </div>
                            <div class="card"  style="border-radius: 10px;width: 100%;margin-bottom: 10px">
                                <div class="table-responsive">
                                    <table id="datatable" class="table table-bordered">
                                        <tr>
                                            <td>商品名称</td>
                                            <td th:text="${order.productEntityName}"></td>
                                        </tr>
                                        <tbody>
                                        <tr>
                                            <td>购买时间</td>
                                            <td th:text="${order.createTime}"></td>
                                        </tr>
                                        <tr>
                                            <td>购买数量</td>
                                            <td th:text="${order.totalNum}"></td>
                                        </tr>
                                        <tr>
                                            <td>付款金额</td>
                                            <td th:text="${order.payMoney}"></td>
                                        </tr>
                                        <tr>
                                            <td>支付状态</td>
                                            <td th:switch="${order.payStatus}" class="text-center">
                                                <span th:case="'0'">完成支付</span>
                                                <span th:case="'1'">支付未被确认</span>
                                                <span th:case="'2'">未支付</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>发货状态</td>
                                            <td th:switch="${order.consignStatus}" class="text-center">
                                                <span th:case="'0'">已收货</span>
                                                <span th:case="'1'">已发货</span>
                                                <span th:case="'2'">未发货</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>物流名称</td>
                                            <td th:text="${order.shippingName}"></td>
                                        </tr>
                                        <tr>
                                            <td>物流单号</td>
                                            <td th:text="${order.shippingCode}"></td>
                                        </tr>
                                        <tr>
                                            <td>订单状态</td>
                                            <td th:switch="${order.orderStatus}" class="text-center">
                                                <span th:case="'0'">已完成</span>
                                                <span th:case="'1'">未完成</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>电话号码</td>
                                            <td>
                                                <div type="text" name="receiverMobile"
                                                     th:text="${order.receiverMobile}"></div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>确认收货</td>
                                            <td th:switch="${order.consignStatus}" class="text-center">
                                                <a th:case="0">已确认收货</a>
                                                <a th:case="'1'">
                                                    <button type="button" class="btn btn-outline-success" data-toggle="modal" data-target="#myModal">确认
                                                    </button>
                                                </a>
                                                <!-- 模态框（Modal） -->
                                                <div style="margin-top: 100px" class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                                    <div class="modal-dialog">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h4 class="modal-title" id="myModalLabel">确认用户已支付</h4>
                                                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                            </div>
                                                            <div class="modal-body">确认用户已支付</div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                                                                <button type="button" class="btn btn-primary" th:onclick="|orderConfirmReceipt(${order.id})|">确认</button>
                                                            </div>
                                                        </div><!-- /.modal-content -->
                                                    </div><!-- /.modal -->
                                                </div>


                                                <a th:case="2">未发货</a>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>

            </div>

        </div>
    </div>

    <div id="preloader">
        <div class="loader" id="loader-1"></div>
    </div>


    <script th:src="@{/assets/js/jquery-min.js}"></script>
    <script th:src="@{/assets/js/popper.min.js}"></script>
    <script th:src="@{/assets/js/bootstrap.min.js}"></script>
    <script th:src="@{/assets/js/jquery.app.js}"></script>
    <script th:src="@{/assets/js/main.js}"></script>

    <script th:src="@{/assets/plugins/datatables/jquery.dataTables.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/dataTables.bootstrap4.min.js}"></script>

    <script th:src="@{/assets/plugins/datatables/dataTables.buttons.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/buttons.bootstrap4.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/jszip.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/pdfmake.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/vfs_fonts.js}"></script>
    <script th:src="@{/assets/plugins/datatables/buttons.html5.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/buttons.print.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/buttons.colVis.min.js}"></script>

    <script th:src="@{/assets/plugins/datatables/dataTables.responsive.min.js}"></script>
    <script th:src="@{/assets/plugins/datatables/responsive.bootstrap4.min.js}"></script>

    <script th:src="@{/assets/js/datatables.init.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/css/common.css}">
</div>
</body>
<script type="text/javascript">
    $(function () {
        $("#tips").hide();
    });

    function orderConfirmReceipt(orderId) {
        var userId = $("#userId").text();
        console.log(orderId);
        console.log(userId);
        $.post("orderConfirmReceipt",
            {"id": orderId},
            function (data) {
                if (data != "0") {
                    window.open("/front/orderPhone/getAllByUserId?userId=" + userId, "_self");
                } else {
                    $("#tips").text("确认收货失败");
                    $("#tips").show();
                }
            }
        )
    }

    function orderCancel(orderId) {
        var userId = $("#userId").text();
        console.log(orderId);
        console.log(userId);
        $.post("orderCancel",
            {"id": orderId},
            function (data) {
                if (data != "0") {
                    window.open("/front/orderPhone/getAllByUserId?userId=" + userId, "_self");
                } else {
                    $("#tips").text("取消订单失败");
                    $("#tips").show();
                }
            }
        )
    }
</script>

<!-- source http://www.scnoob.com More templates http://www.scnoob.com/moban -->
</html>


